#include "Spline.h"
#include "DigitInputCheck.h"

int main()
{
    spline test;
    test.read();
    test.sort();
    test.solve();
     
    int choice, choice2;
    string check;
    cout << " Do you want to Graph the function?" << endl;
    cout << "<0> No!" << endl;
    cout << "<1> Yes!" << endl;
    cin >> check ;
     if (IsNumeric(check) == true)
    {
        choice = strtof(check.c_str(),NULL);
    }
    else
    {
        cout << "Please Try a Valid Input Next Time" << endl;
    }
    switch(choice)
    {
        case 0:
            cout << "Thank You for Using the Program, Goodbye!" << endl;
            return 0;
            break;
        case 1:
            cout << "Where do you want the output?" << endl;
            cout << "<1> Console" << endl;
            cout << "<2> Text File" << endl;
            cin >> check ;
     if (IsNumeric(check) == true)
    {
        choice2 = strtof(check.c_str(),NULL);
    }
    else
    {
        cout << "Please Try a Valid Input Next Time" << endl;
    }
            switch (choice2)
            {
                case 1: test.graph();
                break;
                case 2: test.output();
                break;
                default: cout << "Invalid Input Detected, Exiting Program" << endl;
                break;
            }
            break;
            
        default: cout << "Invalid Input Detected, Exiting Program" << endl;
                break;
            }
            
    return 0;
}
